<?php 
	/*
		邮件列表
		取出中文有乱码，英文就正常
		提取去正常的base64码然后解码
		@显示邮件列表
		
	*/
	require_once("mail_power.php");
	
	
	function decode_head($str_fd){
		if(strstr($str_fd,'?')){
	    $str=substr($str_fd,10);
		$arr=explode("?=",$str);
		return $arr;
		}else{
			return $str_fd;
		}
	}
?>
<div>
<form action="mail_action.php" method="post"><!--提交操作删除-->
<input type="submit" name="deletemail"  value="删除"/>
<input type="search" name="search"  />
<input type="button" id="allselect" value="全部选择" />
<input type="button" id="reset" value="全部取消" />
<table>
	<tr>
    	<th>选择</th><th>发件人</th><th>主题</th><th>收件时间</th>
    </tr>
    <?php 
	$num=$im->getNum();
	//$num=3;
	for($i=1;$i<$num;$i++){
	$head=$im->getHeader($i);
	//print_r($head);	
	@$arr=decode_head($head->fromaddress); 
	$arr_1=decode_head($head->subject);
	?>
    <a href="http://127.0.0.1/file_model/app/mail/mail_conten.php?uid=<?php echo $i; ?>" >
    <tr>
   		<td class=""><input type="checkbox" name="uid[]" value="<?php echo $i; ?>"/></td>
         <td>
		 <?php  	 
		  echo @base64_decode($arr[0]).$arr[1];
		 ?>
         </td>
         <td>
		 <?php 
		 echo base64_decode($arr_1[0]);
		 ?>
         </td>
         <td>
		 <?php 
		 echo $head->date; 
		 ?>
         </td>
    </tr> 
    </a>
    <?php 
	}
	?>
   
</table>
</form>
</div>
<style type="text/css">
table{ width:800px; text-align:center; margin:0; line-height:20px; border:0; padding:0;}
table tr th{ background:#63F; height:20px; color:#FF3;}
table tr td{ background:#3F9; height:20px;}
</style>
<script src="../../ui/js/jQuery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
	$("#allselect").click( function(){
			$(':checkbox').attr("checked",'checked');
			$(":button").val()="全部取消";
		});
	$("#reset").click( function(){
		$(":checkbox").removeAttr("checked");
		});
});
</script>
<meta http-equiv="Content-Type" content="text/html; charset="utf-8" />




